package game;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
public class test9 {
    public static void main(String[] args) throws IOException {
        //1.创建Reader对象 ==> 打开文件
        try(Reader reader = new FileReader("d:/mma.txt")){
            //2.创建cbuf数组，一次读取多个字符
            char[] cbuf = new char[1024];
            while(true) {
                //n代表当前读取到的字符的个数
                int n = reader.read(cbuf);
                if(n == -1) {
                    break;
                }
                System.out.println("n = " + n);
                for (int i = 0; i < n; i++) {
                    System.out.println(cbuf[i]);
                }
            }
        }
    }
}
